Lecture 14 — rolling up our sleeves to write actual YAML workflows for GitHub Actions, creating Dockerfiles, and provisioning infrastructure using Terraform and Ansible playbooks.
Note: In this session, we will look at the exact code and command-line steps required to build out a complete pipeline from code to infrastructure.
We have a basic Express application with a few endpoints. It uses npm start to run and npm test to run a suite of Jest tests.
File location: .github/workflows/ci.yml
This tells GitHub to run the pipeline automatically whenever someone pushes code to the main branch, or opens a Pull Request targeting main. This is the heart of Continuous Integration.
GitHub automatically provisions a clean, temporary Ubuntu virtual machine for us. We don't have to manage any servers to run our CI.
These are pre-built, community steps. checkout@v3 clones our Git repo into the runner. setup-node@v3 installs the correct version of Node.js.
These are the actual bash commands executed on the runner. npm ci strictly installs dependencies from the lockfile, and npm test executes Jest.
File location: Dockerfile (in the root of the project)
Once the Dockerfile is written, we use the Docker CLI to build the immutable image and run it.
File location: main.tf (Now we need a server to run our container on).
Downloads the AWS provider plugins needed to execute the code.
Generates an execution plan. It says: "I will create 1 Security Group and 1 EC2 instance."
Actually makes the API calls to AWS to create the resources. Generates a terraform.tfstate file.
Now that Terraform created the raw Ubuntu VM, we use Ansible to install Docker and run our application container.
We've just built a fully automated pipeline. If a developer changes code, here is what happens automatically:
.github/workflows/ci.yml and runs the Jest tests.Dockerfile, builds the image, and pushes it to a registry.deploy.yml), which connects to the AWS server created by Terraform (main.tf).on: push triggers, runs on virtual machines, executes shell commands.FROM, WORKDIR, COPY, RUN, CMD.provider, resource. Workflow is Init → Plan → Apply.Introduction to Testing; Verification & Validation; Types of Testing (White-box, Manual, Automation).
We've successfully moved from DevOps theory into actual implementation and coding. Unit VI will focus on the Testing phase of the lifecycle.